home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / disk / misc / CltdUtils.lha / Cap.asm next >
Encoding:
Assembly Source File  |  1990-05-24  |  14.5 KB  |  562 lines

  1. *****************************************************************************
  2. *  Program:  Cap V1.0 - ©1990 by Jeff Lavin
  3. *  Descrip:  Read the capacity of a C-Ltd SCSI Drive.
  4. *    Usage:  1> Cap <unit>
  5. *   Author: Jeff Lavin
  6. *  History: 05/21/90 V1.00 Created
  7. *
  8. ******************************* tear here ***********************************
  9.  
  10. SYS    macro        ;General purpose macro
  11.     jsr    _LVO\1(a6)    ;Call the function
  12.     endm
  13.  
  14. STRUCTURE    macro
  15. \1    set    0
  16. SOFFSET    set    \2
  17.     endm
  18.  
  19. APTR    macro
  20. \1    equ    SOFFSET
  21. SOFFSET    set    SOFFSET+4
  22.     endm
  23.  
  24. BPTR    macro
  25. \1    equ    SOFFSET
  26. SOFFSET    set    SOFFSET+4
  27.     endm
  28.  
  29. LONG    macro
  30. \1    equ    SOFFSET
  31. SOFFSET    set    SOFFSET+4
  32.     endm
  33.  
  34. WORD    macro
  35. \1    equ    SOFFSET
  36. SOFFSET    set    SOFFSET+2
  37.     endm
  38.  
  39. BYTE    macro
  40. \1    equ    SOFFSET
  41. SOFFSET    set    SOFFSET+1
  42.     endm
  43.  
  44. STRUCT    macro
  45. \1    equ    SOFFSET
  46. SOFFSET    set    SOFFSET+\2
  47.     endm
  48.  
  49. LABEL    macro
  50. \1    equ    SOFFSET
  51.     endm
  52.  
  53. SysBase    equ    4    ;Exec library base pointer
  54.  
  55. cd_BoardAddr    equ    $20    ;ConfigDev Structure
  56.  
  57. * AutoConfig Board Equates
  58.  
  59. MANF_CLTD    equ    1004    ;Manufacturer number
  60. PROD_12    equ    12    ;Current product rev number
  61. PROD_14    equ    14    ;Earlier product rev number
  62. CLTD_HOST    equ    7    ;SCSI Unit number of Host Controller
  63.  
  64. * Class 00 SCSI Command Structure - (General form, specific commands vary)
  65.  
  66. sc_cmd    equ    0    ;Command OpCode
  67. sc_adrH    equ    1    ;Logical Block Address (MSB)
  68. sc_adrM    equ    2    ;Logical Block Address
  69. sc_adrL    equ    3    ;Logical Block Address (LSB)
  70. sc_count    equ    4    ;Block Count
  71. sc_reserv    equ    5    ;Reserved
  72.  
  73. * NCR5380 SCSI Host Controller registers  - Offset = ([reg] * 2) + 1
  74. * ------------------------------------------------------------------
  75. ncr_data    equ    $01    ;(0) Current SCSI Data           (R)
  76.             ;    Output Data                 (W)
  77. ncr_icmd    equ    $03    ;(1) Initiator Command           (R/W)
  78. ncr_mode    equ    $05    ;(2) Mode                        (R/W)
  79. ncr_tcmd    equ    $07    ;(3) Target Command              (R/W)
  80. ncr_bstat    equ    $09    ;(4) Current SCSI Bus Status     (R)
  81.             ;    Select Enable               (W)
  82. ncr_stat    equ    $0B    ;(5) Bus and Status              (R)
  83.             ;    Start DMA Send              (W)
  84. ncr_input    equ    $0D    ;(6) Input Data                  (R)
  85.             ;    Start DMA Target Receive    (W)
  86. ncr_reset    equ    $0F    ;(7) Reset Parity/Interrupts     (R)
  87.             ;    Start DMA Initiator Receive (W)
  88. * SCSI Command OpCodes
  89.  
  90. READ_CAP    equ    $25
  91.  
  92. * Equates for Initiator Command Register (1)
  93.  
  94. ASS_NOT    equ    %00000000    ;Assert nothing, i.e., free data bus
  95. ASS_BUS    equ    %00000001    ;Assert Data Bus
  96. ASS_ATN    equ    %00000010    ;Assert Attention
  97. ASS_SEL    equ    %00000100    ;Assert Select
  98. ASS_BSY    equ    %00001000    ;Assert Busy
  99. ASS_ACK    equ    %00010000    ;Assert Acknowledge
  100. ASS_RST    equ    %10000000    ;Assert Reset
  101.  
  102. * Equates for Mode Register (2)
  103.  
  104. ARBITRATE    equ    0    ;Start arbitration
  105. MONITOR_BSY    equ    2    ;Generate busy lost interrupt
  106.  
  107. * SCSI Information Transfer Phases (for Target Command Register (3))
  108.  
  109. ASS_IO    equ    %00000001    ;Assert I/O
  110. ASS_CD    equ    %00000010    ;Assert C/D
  111. ASS_MSG    equ    %00000100    ;Assert MSG
  112.  
  113. PH_DOUT    equ    0    ;Data Out Phase
  114. PH_DIN    equ    ASS_IO    ;Data In Phase
  115. PH_CMD    equ    ASS_CD    ;Command Phase
  116. PH_STAT    equ    ASS_IO!ASS_CD    ;Status Phase
  117. PH_MOUT    equ    ASS_CD!ASS_MSG    ;Message Out Phase
  118. PH_MIN    equ    ASS_IO!ASS_CD!ASS_MSG ;Message In Phase
  119.  
  120. * Bit defs for Bus Status Register (4)
  121.  
  122. BCBS_DBP    equ    0    ;Data Bus Parity Status
  123. BCBS_SEL    equ    1    ;Select Phase Status
  124. BCBS_IO    equ    2    ;I/O Direction
  125. BCBS_CD    equ    3    ;Control / Data Status
  126. BCBS_MSG    equ    4    ;Message Phase
  127. BCBS_REQ    equ    5    ;Data Request Status
  128. BCBS_BSY    equ    6    ;SCSI Bus Busy Status
  129. BCBS_RST    equ    7    ;SCSI Bus Reset Status
  130.  
  131. * Equates for Status Register (5)
  132.  
  133. PHAS_MATCH    equ    3    ;Phase match bit def
  134. INT_REQ    equ    4    ;Interrupt request bit def
  135. DMA_REQ    equ    6    ;DMA request bit def
  136.  
  137. * Program variables
  138.  
  139.                STRUCTURE    WorkArea,0
  140.     APTR    InitialSP
  141.     APTR    DosBase
  142.     APTR    ExpBase
  143.     BPTR    stdout
  144.     WORD    Error    ;Offset into error msg table
  145.     BYTE    Device    ;SCSI Device number
  146.     BYTE    Unit    ;Adaptec Unit number
  147.     STRUCT    FmtArgs,4*4    ;Format args
  148.     STRUCT    SCSICmd,10    ;SCSI Command structure
  149.     STRUCT    OutBuf,200    ;Output buffer
  150.     STRUCT    DataBuf,256    ;Read data buffer
  151.     LABEL    Work_Sizeof
  152.  
  153. _LVODisable    equ    -$78
  154. _LVOEnable    equ    -$7E
  155. _LVOCloseLibrary    equ    -$19E
  156. _LVORawDoFmt    equ    -$20A
  157. _LVOOpenLibrary    equ    -$228
  158.  
  159. _LVOWrite    equ    -$30
  160. _LVOOutput    equ    -$3C
  161.  
  162. _LVOFindConfigDev    equ    -$48
  163.  
  164.     errfile    'ram:assem.output'
  165.     exeobj
  166.     objfile    'Cap'
  167.  
  168. Cap    lea    DT(pc),a5
  169.     movea.l    a5,a1    ;Clear BSS section
  170.     move.w    #(Work_Sizeof/4)-1,d1
  171. 1$    clr.l    (a1)+
  172.     dbra    d1,1$
  173.  
  174.     move.l    d0,d2    ;Save cmd line
  175.     movea.l    a0,a2
  176.     move.l    sp,InitialSP(a5)
  177.  
  178.     movea.l    SysBase,a6
  179.     lea    DosName(pc),a1
  180.     moveq    #0,d0
  181.     SYS    OpenLibrary    ;Open dos.library
  182.     move.l    d0,DosBase(a5)
  183.     beq    Exit
  184.  
  185.     movea.l    d0,a6
  186.     SYS    Output
  187.     move.l    d0,stdout(a5)
  188.     beq    Cleanup
  189.  
  190.     lea    BannerStr(pc),a0
  191.     bsr    Puts
  192.  
  193.     move.l    d2,d0    ;Get cmd line
  194.     movea.l    a2,a0
  195.     lea    0(a0,d0.w),a1
  196. 2$    cmpi.b    #' ',-(a1)    ;Eat trailing garbage
  197.     dbhi    d0,2$
  198.     blt    Instruct    ;If no args, error
  199.     clr.b    1(a1)    ;Null terminate the string
  200.  
  201. 3$    move.b    (a0)+,d0
  202.     beq    Instruct    ;No args
  203.     cmpi.b    #' ',d0    ;Skip spaces
  204.     beq.s    3$
  205.     cmpi.b    #'?',d0    ;Instruct?
  206.     beq    Instruct    ;"Usage:..."
  207.     subi.b    #$30,d0    ;Convert to number
  208.     blt    Error1    ;Not a number
  209.     cmpi.b    #15,d0    ;Only Units 0 to 15 allowed
  210.     bgt    Error1    ;Out of range
  211.     move.b  d0,d1
  212.     andi.b    #%00000111,d0    ;Extract Device number & save
  213.     move.b  d0,Device(a5)
  214.     lsr.b    #3,d1    ;Extract Adaptec unit number
  215.     lsl.b    #5,d1    ; and move to proper bit pos.
  216.     move.b  d1,Unit(a5)    ;Save unit
  217.  
  218.     movea.l    SysBase,a6
  219.     lea    ExpName(pc),a1    ;Open expansion.library
  220.     moveq    #0,d0    ;Any version
  221.     SYS    OpenLibrary
  222.     move.l    d0,ExpBase(a5)
  223.     beq    Error2
  224.  
  225.     movea.l    d0,a6
  226.     suba.l    a0,a0
  227.     move.l    #1004,d3
  228.     moveq    #14,d2
  229.     move.l    d3,d0
  230.     move.l    d2,d1
  231.     SYS    FindConfigDev
  232.     tst.l    d0
  233.     bne.s    4$
  234.  
  235.     suba.l    a0,a0
  236.     move.l    d3,d0
  237.     moveq    #12,d2
  238.     move.l    d2,d1
  239.     SYS    FindConfigDev
  240.     tst.l    d0
  241.     beq    Error3
  242. 4$    movea.l    d0,a4    ;Ptr to ConfigDev structure
  243.     movea.l    cd_BoardAddr(a4),a4
  244.  
  245.     movea.l    a6,a1
  246.     movea.l    SysBase,a6
  247.     SYS    CloseLibrary
  248.     clr.l    ExpBase(a5)
  249.  
  250.     move.b  Device(a5),d1
  251.     bsr    GenCmd    ;Generate the SCSI command
  252.     beq    Error4    ;Bad return, exit
  253.  
  254.     lea     SCSICmd(a5),a3    ;Build our SCSI command
  255.     movea.l    a3,a0
  256.     move.b  #READ_CAP,(a0)+    ;Bit 0-4 = OpCode
  257.     move.b  Unit(a5),(a0)+    ;Bit 5-7 = Logical unit number
  258.     clr.b  (a0)+    ;Logical Block Addr (MSB)
  259.     clr.b  (a0)+    ;Logical Block Addr
  260.     clr.b  (a0)+    ;Logical Block Addr
  261.     clr.b  (a0)+    ;Logical Block Addr (LSB)
  262.     clr.b  (a0)+    ; Not used for this command
  263.     clr.b  (a0)+    ; Not used for this command
  264.     clr.b  (a0)+    ;Partial Media Indicator
  265.     clr.b  (a0)    ; Not used for this command
  266.     bsr    ScsiOutCmd    ;Send the SCSI command
  267.  
  268.     lea    DataBuf(a5),a2
  269.     bsr    GetData
  270.     bsr    SCSIStat
  271.     tst.b    d0
  272.     bne.s    Error5
  273.  
  274.     lea    FmtArgs(a5),a1
  275.     moveq    #0,d0
  276.     move.b    Device(a5),d0
  277.     move.w    d0,(a1)
  278.     move.b    Unit(a5),d0
  279.     lsr.b    #5,d0
  280.     move.w    d0,2(a1)
  281.     lea    DataBuf(a5),a0
  282.     move.l    (a0),d0    ;Block addr
  283.     move.l    d0,4(a1)
  284.     moveq    #9,d1
  285.     lsl.l    d1,d0
  286.     move.l    d0,8(a1)
  287.     lea    Capacity.fmt(pc),a0
  288.     bsr    Printf    ;"Capacity of Device %d, LUN %d = %ld Sectors, %ld Bytes"
  289.     bra.s    Cleanup
  290.  
  291. Error5    addq.w    #4,Error(a5)    ;"Error reading capacity!!!"
  292. Error4    addq.w    #4,Error(a5)    ;"Drive not responding"
  293. Error3    addq.w    #4,Error(a5)    ;"NO CLtd Controller Found"
  294. Error2    addq.w    #4,Error(a5)    ;"Couldn't open expansion.library"
  295. Error1    addq.w    #4,Error(a5)    ;"Unit number must be 0>=15"
  296. Instruct    bsr    ReportError    ;"Usage: 1> Cap <unit>"
  297. Cleanup    movea.l    SysBase,a6
  298.     move.l    ExpBase(a5),d0
  299.     beq.s    1$
  300.     movea.l    d0,a1
  301.     SYS    CloseLibrary
  302.  
  303. 1$    move.l    DosBase(a5),d0
  304.     beq.s    Exit
  305.     movea.l    d0,a1
  306.     SYS    CloseLibrary
  307.  
  308. Exit    move.l    InitialSP(a5),sp
  309.     moveq    #0,d0
  310.     rts
  311.  
  312. ********************************************************************
  313. * NAME:     GenCmd()
  314. * FUNCTION: Setup SCSI bus for command phase & generate a class 00
  315. *           SCSI command.
  316. * INPUTS:   D1 = SCSI Device number
  317. *           A4 = NCR5380 base address
  318. * RETURN:   D0 = 0 if successful, or error code.
  319. * SCRATCH:  None
  320. ********************************************************************
  321.  
  322. GenCmd    move.l    #$40000,d0
  323. 1$    btst    #BCBS_BSY,ncr_bstat(a4)    ;Wait for free bus
  324.     beq.s    2$        ;If this doesn't happen after a
  325.     subq.l    #1,d0        ; while, exit (rather than hang).
  326.     bmi.s    4$
  327.     bpl.s    1$
  328. 2$    move.b    #PH_DOUT,ncr_tcmd(a4)    ;Setup 'Data Out' bus phase
  329.     moveq    #1,d0        ;Wait 1 bus settle delay
  330.     lsl.b    d1,d0        ;Shift device ID to a bit number
  331.     bset.b    #CLTD_HOST,d0        ;OR with ID of Host Controller
  332.     move.b    d0,ncr_data(a4)        ;Place ID on the data bus
  333.     nop            ;Wait 2 deskew delays
  334.     move.b    #ASS_BUS!ASS_SEL,ncr_icmd(a4) ;Assert select
  335.     move.l    #$40000,d0
  336. 3$    btst    #BCBS_BSY,ncr_bstat(a4)    ;Wait for target to respond
  337.     bne.s    5$        ; by asserting busy.
  338.     subq.l    #1,d0
  339.     bpl.s    3$        ;If this doesn't happen after a
  340. 4$    moveq    #0,d0        ; while, exit (rather than hang).
  341.     rts
  342.  
  343. 5$    nop            ;Wait 2 deskew delays
  344.     move.b    #ASS_NOT,ncr_icmd(a4)    ; and deassert select.
  345.     moveq    #1,d0
  346.     rts
  347.  
  348. *************************************************************************
  349. * NAME:     ScsiOutCmd()
  350. * FUNCTION: Send a class 00 command out the SCSI bus.
  351. * INPUTS:   A3 = Ptr to SCSICmd structure
  352. *           A4 = NCR5380 base address
  353. * RETURN:   None
  354. * SCRATCH:  None
  355. *************************************************************************
  356.  
  357. ScsiOutCmd    move.l    a3,-(sp)
  358.     tst.b    (a3)        ;If opcode 00 (Test Unit Ready),
  359.     beq.s    1$        ; go directly to Data Out phase.
  360.     move.b    #PH_CMD,ncr_tcmd(a4)    ;Else, setup 'Command' phase
  361.     bra.s    2$
  362. 1$    move.b    #PH_DOUT,ncr_tcmd(a4)    ;Setup 'Data Out' phase
  363.  
  364. 2$    move.b    #ASS_BUS,ncr_icmd(a4)    ;Assert the data bus
  365. 3$    btst    #BCBS_REQ,ncr_bstat(a4)    ;Wait for target to
  366.     beq.s    3$        ; assert Request.
  367.     btst    #PHAS_MATCH,ncr_stat(a4)    ;If we're not still in the
  368.     beq.s    5$        ; right phase, exit.
  369.     move.b    (a3)+,ncr_data(a4)    ;OK, send a byte of command
  370.     move.b    #ASS_BUS!ASS_ACK,ncr_icmd(a4) ;Send an ACK to target
  371. 4$    btst    #BCBS_REQ,ncr_bstat(a4)    ;Wait for target to
  372.     bne.s    4$        ; deassert Request.
  373.     move.b    #ASS_BUS,ncr_icmd(a4)    ;Reassert the data bus
  374.     bra.s    3$        ; and send the next byte.
  375.  
  376. 5$    move.b    #ASS_NOT,ncr_icmd(a4)    ;We got here because of a glitch
  377.     movea.l    (sp)+,a3        ; or we sent all the cmd bytes.
  378.     rts
  379.  
  380. *************************************************************************
  381. * NAME:     GetData()
  382. * FUNCTION: Do pseudo-DMA data transfer from SCSI bus.
  383. * INPUTS:   A2 = Data buffer.
  384. *           A4 = NCR5380 base address.
  385. * RETURN:   None
  386. * SCRATCH:  D0-D1/A0-A1
  387. *************************************************************************
  388.  
  389. GetData    move.l    a2,-(sp)
  390.     SYS    Disable
  391.     move.b    #PH_DIN,ncr_tcmd(a4)    ;Data In phase
  392. 1$    btst    #BCBS_REQ,ncr_bstat(a4)
  393.     beq.s    1$
  394.     btst    #PHAS_MATCH,ncr_stat(a4)
  395.     beq.s    11$
  396.  
  397.     move.b    #MONITOR_BSY,ncr_mode(a4)
  398.     move.b    #0,ncr_reset(a4)    ;Start DMA receive
  399.     move.b    #DMA_REQ,d1
  400.     lea    ncr_input(a4),a0
  401.     lea    ncr_stat(a4),a1
  402. 2$    btst    d1,(a1)
  403.     beq.s    3$
  404.     move.b    (a0),(a2)+
  405. 3$    btst    d1,(a1)
  406.     beq.s    4$
  407.     move.b    (a0),(a2)+
  408. 4$    btst    d1,(a1)
  409.     beq.s    5$
  410.     move.b    (a0),(a2)+
  411. 5$    btst    d1,(a1)
  412.     beq.s    6$
  413.     move.b    (a0),(a2)+
  414. 6$    btst    d1,(a1)
  415.     beq.s    7$
  416.     move.b    (a0),(a2)+
  417. 7$    btst    d1,(a1)
  418.     beq.s    8$
  419.     move.b    (a0),(a2)+
  420. 8$    btst    d1,(a1)
  421.     beq.s    9$
  422.     move.b    (a0),(a2)+
  423. 9$    btst    d1,(a1)
  424.     beq.s    10$
  425.     move.b    (a0),(a2)+
  426. 10$    btst    #INT_REQ,(a1)
  427.     beq.s    2$
  428.     move.b    #ARBITRATE,ncr_mode(a4)
  429.     tst.b    ncr_reset(a4)    ;Dummy read
  430. 11$    SYS    Enable
  431.     movea.l    (sp)+,a2
  432.     rts
  433.  
  434. *************************************************************************
  435. * NAME:     SCSIStat()
  436. * FUNCTION: Test the status of the SCSI bus.
  437. * INPUTS:   A4 = NCR5380 base address
  438. * RETURN:   D0 = Status
  439. * SCRATCH:  None
  440. *************************************************************************
  441.  
  442. SCSIStat    move.b    #PH_STAT,ncr_tcmd(a4)    ;Assert I/O and C/D
  443. 1$    btst    #BCBS_REQ,ncr_bstat(a4)    ;Wait for target to
  444.     beq.s    1$        ; assert Request.
  445.     moveq    #0,d0
  446.     move.b    ncr_data(a4),d0        ;Get status byte
  447.     move.b    #ASS_ACK,ncr_icmd(a4)    ;Send an ACK to target
  448. 2$    btst    #BCBS_REQ,ncr_bstat(a4)    ;Wait for target to
  449.     bne.s    2$        ; deassert Request.
  450.     move.b    #ASS_NOT,ncr_icmd(a4)    ;Drop bus
  451.     move.b    #PH_MIN,ncr_tcmd(a4)    ;Setup 'Message In' phase
  452. 3$    btst    #BCBS_REQ,ncr_bstat(a4)    ;Wait for target to
  453.     beq.s    3$        ; assert Request.
  454.     tst.b    ncr_data(a4)        ;Dummy read (expected)
  455.     move.b    #ASS_ACK,ncr_icmd(a4)    ;Send an ACK to target
  456. 4$    btst    #BCBS_REQ,ncr_bstat(a4)    ;Wait for target to
  457.     bne.s    4$        ; deassert Request.
  458.     move.b    #ASS_NOT,ncr_icmd(a4)    ;Drop bus
  459.     rts
  460.  
  461. *********************************************************************
  462. * NAME:     Printf()
  463. * FUNCTION: Print formatted strings to stdout.
  464. * INPUTS:   A0 = Format string.
  465. *           A1 = Ptr to arguments.
  466. * RETURN:   None
  467. * SCRATCH:  D0-D1/A0-A1
  468. *********************************************************************
  469.  
  470. Printf    movem.l    a2-a3/a6,-(sp)
  471.     lea    KPutChar(pc),a2    ;Byte fill routine
  472.     lea    OutBuf(a5),a3
  473.     move.l    a3,-(sp)
  474.     movea.l    SysBase,a6
  475.     SYS    RawDoFmt    ;Do it!
  476.     movea.l    (sp)+,a0
  477.     bsr.s    Puts
  478.     movem.l    (sp)+,a2-a3/a6
  479.     rts
  480.  
  481. KPutChar    move.b    d0,(a3)+
  482.     rts
  483.  
  484. *************************************************************************
  485. * NAME:     Puts()
  486. * FUNCTION: Writes a message to stdout.
  487. * INPUTS:   A0 = Ptr to message.
  488. * RETURN:   None
  489. * SCRATCH:  D0-D1/A0-A1
  490. *************************************************************************
  491.  
  492. Puts    movem.l    d2-d4/a6,-(sp)
  493.     move.l    stdout(a5),d4
  494.     bsr.s    WriteMsg
  495.     movem.l    (sp)+,d2-d4/a6
  496.     rts
  497.  
  498. *************************************************************************
  499. * NAME:     WriteMsg()
  500. * FUNCTION: Common subroutine used by FPrintf, Printf, and Puts.
  501. * INPUTS:   A0 = Ptr to message.
  502. *           D4 = FileHandle.
  503. * RETURN:   None
  504. * SCRATCH:  D0-D1/A0-A1
  505. *************************************************************************
  506.  
  507. WriteMsg    move.l    a0,d3
  508. 1$    tst.b    (a0)+
  509.     bne.s    1$
  510.     exg    a0,d3
  511.     sub.l    a0,d3
  512.     subq.l    #1,d3    ;Length
  513.     move.l    a0,d2    ;Buffer
  514.     move.l    d4,d1    ;FileHandle
  515.     movea.l    DosBase(a5),a6
  516.     SYS    Write
  517.     rts
  518.  
  519. *************************************************************************
  520. * NAME:     ReportError()
  521. * FUNCTION: Sends the appropriate error message to stdout.
  522. * INPUTS:   Error = Offset from ErrStr.tbl.
  523. * RETURN:   None
  524. * SCRATCH:  D0-D1/A0-A1
  525. *************************************************************************
  526.  
  527. ReportError    move.w    Error(a5),d0
  528.     movea.l    ErrStr.tbl(pc,d0.w),a0
  529.     bra.s    Puts
  530.  
  531. ErrStr.tbl    dl    Usage.msg
  532.     dl    Error1.msg
  533.     dl    Error2.msg
  534.     dl    Error3.msg
  535.     dl    Error4.msg
  536.     dl    Error5.msg
  537.  
  538. Usage.msg    db    'Usage: 1> Cap <unit>',10
  539.     db    'Where <unit> is a number from 0 to 15.',10
  540.     db    'Unit 0 corresponds to Device 1, logical unit 0.',10
  541.     db    'Unit 8 corresponds to Device 1, logical unit 1.',10
  542.     db    'Unit 1 corresponds to Device 2, logical unit 0.',10
  543.     db    'Unit 9 corresponds to Device 2, logical unit 1.',10
  544.     db    '(To address the 2nd logical device on an Adaptec',10
  545.     db    ' 4000 series, add 8 to the SCSI Device number.)',10,0
  546. Error1.msg    db    'Unit number must be >= 0 and <= 15.',10,0
  547. Error2.msg    db    'Couldn''t open expansion.library.',10,0
  548. Error3.msg    db    '** NO CLtd Controller Found **',10,0
  549. Error4.msg    db    'Drive not responding.  Wrong unit number?',10,0
  550. Error5.msg    db    'Error reading capacity!!!',0
  551.  
  552. BannerStr    db    'Hard Drive Read Capacity V1.0 - ©1990 by Jeff Lavin',10,10,0
  553. Capacity.fmt    db    'Capacity of Device %d, LUN %d = %ld Sectors, %ld Bytes',10,10,0
  554.  
  555. DosName    db    'dos.library',0
  556. ExpName    db    'expansion.library',0
  557.     cnop    0,4
  558.  
  559. DT    dx.b    Work_Sizeof
  560.  
  561.     end
  562.